package com.lineage.data.item_etcitem.add;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.BroadcastController;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_SystemMessage;
import com.lineage.server.serverpackets.ServerBasePacket;

public class BroadcastCard extends ItemExecutor {
  public static ItemExecutor get() {
    return new BroadcastCard();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    if (BroadcastController.getInstance().isStop()) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("广播系统目前已被管理员关闭。"));
      if (pc.isGm()) {
        pc.sendPackets((ServerBasePacket)new S_SystemMessage("需要重新开启广播系统请输入  \"开启\"。"));
        pc.setSkillEffect(8008, 30000);
      } 
      return;
    } 
    pc.sendPackets((ServerBasePacket)new S_SystemMessage(
          "请在30秒内输入想要广播的讯息 (目前已有 " + BroadcastController.getInstance().getMsgSize() + "笔讯息等候广播)"));
    pc.setSkillEffect(8008, 30000);
  }
}
